home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / apps / 42 / apndx8.prf < prev    next >
Text File  |  1986-07-17  |  2KB  |  78 lines

  1. .!****************************************************************************
  2. .! 
  3. .! ANTIC PUBLISHING INC., COPYRIGHT 1985.  REPRINTED BY PERMISSION.
  4. .!
  5. .! ** Professional GEM ** by Tim Oren
  6. .!
  7. .! Proff File by ST enthusiasts at
  8. .! Case Western Reserve University
  9. .! Cleveland, Ohio
  10. .! uucp : decvax!cwruecmp!bammi
  11. .! csnet: bammi@case
  12. .! arpa : bammi%case@csnet-relay
  13. .! compuserve: 71515,155
  14. .!
  15. .!****************************************************************************
  16. .!
  17. .!            Begin Appendix 8
  18. .!
  19. .!***************************************************************************
  20. .!
  21. .!
  22. .AP VIII Sample Code for Part X 
  23. /*
  24. >>>>>>>>>>> Demonstration of byte alignment of window interior <<<<<<<<<<<
  25. */
  26.  
  27. #define FEATURES    0x0fef    /* what border features are used   */
  28. WORD    msg[8];            /* message from evnt_multi       */
  29. GRECT    work_area;        /* defines working area        */
  30. WORD    w_hndl;            /* handle for window being changed */
  31.  
  32.     wind_calc(1, FEATURES, msg[4], msg[5], msg[6], msg[7], 
  33.         &work_area.g_x, &work_area.g_y, &work_area.g_w, 
  34.         &work_area.g_h);
  35.     work_area.g_x = align_x(work_area.g_x);
  36.     work_area.g_w = align_x(work_area.g_w);
  37.     wind_calc(0, FEATURES, work_area.g_x, work_area.g_y, 
  38.         work_area.g_w, work_area.g_h, &msg[4], &msg[5], 
  39.         &msg[6], &msg[7]); 
  40.     wind_set(w_hndl, WF_CXYWH, msg[4], msg[5], msg[6], msg[7]);
  41. .bp
  42. /*
  43. >>>>>>>>>>>>>>>>>>>>> Subroutine for above <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  44. */
  45.     WORD
  46. align_x(x)        /* forces word alignment for column position    */
  47.     WORD    x;        /*   rounding to nearest word        */
  48.     {
  49.     return((x & 0xfff0) + ((x & 0x0008) ? 0x0010 : 0));
  50.     }    
  51. .bp
  52. /*
  53. >>>>>>>>>>>>>>>>>>>>> Standard v_gtext binding <<<<<<<<<<<<<<<<<<<<<<<<<
  54. */
  55.     WORD
  56. v_gtext( handle, x, y, string)
  57.     WORD handle, x, y;
  58.     BYTE *string;
  59.     {
  60.     WORD i;
  61.     ptsin[0] = x;
  62.     ptsin[1] = y;
  63.     i = 0;
  64.     while (intin[i++] = *string++)    /* Copy characters to intin    */
  65.         ;            /* There is NO error checking! */
  66.     contrl[0] = 8;
  67.     contrl[1] = 1;
  68.     contrl[3] = --i;
  69.     contrl[6] = handle;
  70.     vdi();
  71.     }
  72. .!
  73. .!****************************************************************************
  74. .!
  75. .!            End Appendix 8
  76. .!
  77. .!****************************************************************************
  78.